﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using KPIS.GERP.GHRMS.DALFactory;
using KPIS.GERP.GHRMS.IDAL;
using KPIS.GERP.GHRMS.IBLL;
using KPIS.GERP.GHRMS.MODEL;

namespace KPIS.GERP.GHRMS.BLL
{
    public class ExecutiveBLL : IExecutiveBLL
    {
        private static readonly IExecutiveDAL DAL = DataAccess.CreateExecutives();

        private ExecutiveInfo execInfo = new ExecutiveInfo();
        public IList<ExecutiveInfo> ListExecutives(Nullable<int> Sequence, string RecordStatus)
        {
            return DAL.ListExecutives(Sequence, RecordStatus);
        }
        public void Insert(string Name, string NameShort, string NameEng, string NameEngShort
            , string Remarks, string RecordStatus, int CreatedBy)
        {
            try
            {
                execInfo.Name = Name;
                execInfo.NameShort = NameShort;
                execInfo.NameEng = NameEng;
                execInfo.NameEngShort = NameEngShort;
                execInfo.Remarks = Remarks;
                execInfo.RecordStatus = RecordStatus;
                execInfo.CreatedBy = CreatedBy;
                DAL.Insert(execInfo);
            }
            catch
            {
                throw;
            }
        }
        public void Update(int Sequence, string Name, string NameShort, string NameEng, string NameEngShort
            , string Remarks, string RecordStatus, int UpdatedBy)
        {
            try
            {
                execInfo.Sequence = Sequence;
                execInfo.Name = Name;
                execInfo.NameShort = NameShort;
                execInfo.NameEng = NameEng;
                execInfo.NameEngShort = NameEngShort;
                execInfo.Remarks = Remarks;
                execInfo.RecordStatus = RecordStatus;
                execInfo.UpdatedBy = UpdatedBy;
                DAL.Update(execInfo);
                //DAL.Update(new ExecutiveInfo(Sequence, Name, NameShort, NameEng, NameEngShort, Remarks, 0, UpdatedBy));
            }
            catch
            {
                throw;
            }
        }
        public void Delete(int Sequence, int UpdatedBy)
        {
            try 
            {
                DAL.Delete(Sequence, UpdatedBy);
            }
            catch
            {
                throw;
            }
        }
    }
}
